﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CCF20Model.ConfigurationFile
{
    public class CCFLog : IConfiguration
    {
       
        private IConfiguration _previousConfig;
        private string strResult = string.Empty;

        public CCFLog(IConfiguration previousConfig)
        {
            _previousConfig = previousConfig;
        }

        public string VerifyResult()
        {
            WiseLinkConfiguration myConfig = ConfiguraitonHelper.MyConfiguration;

            string ccfLogConnection = ConfiguraitonHelper.GetConfigValueFromAppConfig(AppConfigFileName.CCF, AppConfigFileNodeName.CCF20Log).ToLower();

            if (!ccfLogConnection.Equals(string.Format("{0}\\ccf20.log",myConfig.logdir),StringComparison.OrdinalIgnoreCase))
            {
                ConfiguraitonHelper.SetConfigValueToAppConfig(AppConfigFileName.CCF, AppConfigFileNodeName.CCF20Log,string.Format("{0}\\ccf20.log",myConfig.logdir));
                strResult = "CCF AppConfig File CCF20Log Dir has different value than the configur.xml";
            }

            return string.Format("{0} \r\n{1}", _previousConfig.VerifyResult(), strResult);
        }

    }
}
